#include "UIButton.h"

UIButton::UIButton(IDirect3DTexture9* p_pTextures[4], UIControl* p_pParent) : UIControl(p_pParent)
{
	for (int i = 0; i < 4; ++i)
	{
		m_pTextures[i] = p_pTextures[i];
	}
}

UIButton::~UIButton()
{
}

LPSTR UIButton::getType()
{
	return TEXT("UIButton");
}

void UIButton::draw()
{
	int index = 0;
	if (!m_isEnable)
	{
		index = 3;
	}
	else if (m_isPushed)
	{
		index = 2;
	}
	else if (m_hasFocus || m_bMouseOver)
	{
		index = 1;
	}	
	g_pSprite->Begin(D3DXSPRITE_ALPHABLEND);
	g_pSprite->Draw(m_pTextures[index], 0, 0, &m_v3Location, 0xffffffff);
	g_pSprite->End();
}
